#ifndef _SYMATH_H_
#define _STMATH_H_

namespace sy
{
class math
{

public:
    inline static float pow(float a, int x)
    {
        float ret = 1.0f;
        for(int i = 0; i < x; ++i)
        {
            ret *= a;
        }
        return ret;
    }

    inline static float sin(float x)
    {
        return x - pow(x,3) / 6 + pow(x,5) / 120 - pow(x,7) / 5040 + pow(x, 9) / 362880;
    }

    inline static float cos(float x)
    {
        return 1 - pow(x,2) / 2 + pow(x,4) / 24 - pow(x,6) / 720 + pow(x, 8) / 40320;
    }

    inline static float tan(float x)
    {
        return sin(x) / cos(x);
    }

    inline static float average(float data[], int len)
    {
        if(len <= 0) 
            return 0;
        float sum = 0.0f;
        for(int i = 0; i < len; ++i)
        {
            sum += data[i];
        }
        return sum / len;
    }

    static constexpr float Deg2Rad = 0.0174532;

    static constexpr float Rad2Deg = 57.295780;


};
};


#endif // _STMATH_H_